<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h3>slot作用域插槽</h3>
        <my-component :items="myitems">
           <template slot="item" scope="props">
            <li>{{props.username}}--{{props.text}}</li>
           </template>
        </my-component>
    </div>
    <script type="text/javaScript" charset="UTF-8" src="/JS文件/vue.js"></script>
    <script>
        Vue.component("my-component",{
            props:["items"],
            template:` <ul>
            <hr>
            <slot name="item" v-for="item in items" :username="item.username" :text="item.text"></slot>
            <hr>
        </ul>`,
            created(){
                console.log(this.items);
            }
        })
        var vm = new Vue({
            el:"#app",
            data:{
                myitems:[
                    {
                        username:"Vue",text:"Vu 课程"
                    },{
                        username:"Vue",text:"Vue 课程"
                    },{
                        username:"Vue",text:"Vue 课程"
                    }
            ]
            }
        })
    </script>
</body>
</html>